

#import "BIDRepository.h"
static NSString * const kRepositoryNumberKey = @"Repository";
static NSString * const kRepositoryNameKey = @"Name";
static NSString * const kRepositoryUrlKey = @"Url";
static NSString * const kRepositoryLoginnameKey = @"Loginname";
static NSString * const kRepositoryPasswordKey = @"Password";

@implementation BIDRepository
#pragma mark - NSCoding
- (void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeInt:self.number forKey:kRepositoryNumberKey];
    [aCoder encodeObject:self.name forKey:kRepositoryNameKey];
    [aCoder encodeObject:self.url forKey:kRepositoryUrlKey];
    [aCoder encodeObject:self.loginname forKey:kRepositoryLoginnameKey];
    [aCoder encodeObject:self.password forKey:kRepositoryPasswordKey];
}

- (id)initWithCoder:(NSCoder *)aDecoder{
    if (self = [super init]){
        self.number = [aDecoder decodeIntForKey:kRepositoryNumberKey];
        self.name = [aDecoder decodeObjectForKey:kRepositoryNameKey];
        self.url = [aDecoder decodeObjectForKey:kRepositoryUrlKey];
        self.loginname = [aDecoder decodeObjectForKey:kRepositoryLoginnameKey];
        self.password = [aDecoder decodeObjectForKey:kRepositoryPasswordKey];
    }
    return self;
}
#pragma mark - NSCopying
- (id)copyWithZone:(NSZone *)zone{
    BIDRepository *copy = [[BIDRepository alloc] init];
    copy.number = self.number;
    copy.name = self.name;
    copy.url = self.url;
    copy.loginname = self.loginname;
    copy.password = self.password;
    return copy;
}
@end
